package com.lsa.edmonds.chap8;

import com.lsa.helpers.CollectionUtils;
import com.lsa.shenn.common.Sorter;
import com.lsa.shenn.common.SorterTestCaseBase;
import com.lsa.helpers.Utils;
import java.util.Arrays;
import java.util.List;

public class TestChap8 extends SorterTestCaseBase
{
	public void testMerge()
	{
		List<Integer> list1 = Arrays.asList(1,1,2,2,5,5,7);
		List<Integer> list2 = Arrays.asList(1,1,3,4,6,7,8,8);
		
		List<Integer> list = CollectionUtils.mergeAsc(list1, list2);
		Utils.compareLists(list, Arrays.asList(1,1,1,1,2,2,3,4,5,5,6,7,7,8,8));
		
		list1 = Arrays.asList(1,2,3,4,5);
		list2 = Arrays.asList(3,3,3);
		list = CollectionUtils.mergeAsc(list1, list2);
		Utils.compareLists(list, Arrays.asList(1,2,3,3,3,3,4,5));
		
		list1 = Arrays.asList(3,3,3);
		list2 = Arrays.asList(1,2,3,4,5);
		list = CollectionUtils.mergeAsc(list1, list2);
		Utils.compareLists(list, Arrays.asList(1,2,3,3,3,3,4,5));
		
		list1 = Arrays.asList(1,2,3);
		list2 = Arrays.asList(4,5,6);
		list = CollectionUtils.mergeAsc(list1, list2);
		Utils.compareLists(list, Arrays.asList(1,2,3,4,5,6));
	}
	
	public void testMergeSort()
	{
		MergeSort sorter = new MergeSort();
		testSorter(sorter);
	}
	
	public void testQuickSort()
    {
	    Sorter sorter = new QuickSort();
        testSorter(sorter);
    }
}
